<?php
	// Lấy mã sách từ thanh địa chỉ
	$id = $_GET['msp'];
	$sanpham = new sanphambs();
	$sanpham->MaSanPham = $id;
	$danhsach = $sanpham->GetList();
	
?>
<h3><?php echo "{$danhsach[0]['TenSanPham']}" ?></h3>
<div class="Noidung">
	<?php
    	$hinhanh = new hinhanhbs();
		$hinhanh->MaSanPham = $id;
		$dshinh = $hinhanh->GetList();
		echo "<div class='AnhSanPham'>
				</div>
				<div class='SanPhamChiTiet'>
					<ul>
						<li class='SanPhamThuocTinh'> 
							$danhsach[0]['DonGia']
						</li>
					</ul>
				</div>
			
		";
		echo "</div class='MoTa'>{$danhsach[0]['MoTa']}</div>";
		echo "<p>Giá bán: <span class='GiaBan'>" . number_format($danhsach[0]['DonGia']) . " VNĐ</span></p>";
		echo "<p class='DatMua'><a href='index.php?do=giohang&id={$danhsach[0]['MaSanPham']}'>Đặt mua</a></p>";
	?>
</div>
<div class="Tag">
		<?php
        	echo "<a href='#' >{$danhsach[0]['TenLoai']}</a>";
			echo "<a href='#'>{$danhsach[0]['TenNhomHang']}</a>";
			echo "<a href='#'>{$danhsach[0]['TenNhaSX']}</a>";
			echo "<a href='#' >{$danhsach[0]['TenChatLieu']}</a>";
		?>
</div>
<ul id="mycarousel" class="jcarousel-skin-tango">
		<?php
		$splienket = new sanphambs();
		$loaisp = $danhsach[0]['MaLoai'];
		$splienket->MaLoai = $loaisp;
		$dslk = $splienket->GetList_New();
        for($i = 0; $i < ($dslk == false ? 0 : count($dslk)) ; $i++)
		{
			if($dslk[$i]['SoLuong']>0)
			{
				echo "<li>";
					$hinhanh = new hinhanhbs();
					$hinhanh->MaSanPham = $dslk[$i]['MaSanPham'];
					$dshinh = $hinhanh->GetList();
					echo "<a href='index.php?do=chitietsanpham&msp={$dslk[$i]['MaSanPham']}'><img src='{$dshinh[0]['patch']}' /> </a>";
				echo "</li>";
			}
		}
		?>
</ul>